//
//  HXDPublishTableViewCell.m
//  qingDaoCircleOfLife
//
//  Created by huxuedong on 15/11/30.
//  Copyright © 2015年 huxuedong. All rights reserved.
//

#import "HXDPublishTableViewCell.h"

@interface HXDPublishTableViewCell ()

@property (weak, nonatomic) IBOutlet UITextField *publishText;
@property (weak, nonatomic) IBOutlet UIImageView *starImage;
@property (weak, nonatomic) IBOutlet UIButton *sendButton;

@end

@implementation HXDPublishTableViewCell

+ (instancetype)publishTableViewCell {
    return [[NSBundle mainBundle] loadNibNamed:@"HXDPublishTableViewCell" owner:nil options:nil].lastObject;
}

- (void)awakeFromNib {
    self.sendButton.layer.cornerRadius = 5;
    self.sendButton.clipsToBounds = YES;
    self.publishText.layer.cornerRadius = 2;
    self.publishText.layer.masksToBounds = YES;
}

- (IBAction)starLevel:(UIButton *)sender {
    self.starImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"star_%ld",sender.tag]];
    NSNumber *num = [[NSNumber alloc] initWithLong:sender.tag];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"star" object:num];
}

- (IBAction)publishAction {
    [[NSNotificationCenter defaultCenter] postNotificationName:@"send" object:self.publishText.text];
}

@end
